package com.inno.life.common.enums;

import lombok.Getter;

/**
 * 提醒间隔单位 0-秒 1-分 2-小时 3-天
 */
@Getter
public enum RemindIntervalUnitEnum {
    SECOND("0", "秒"),
    MINUTE("1", "分"),
    HOUR("2", "小时"),
    DAY("3", "天");

    private final String code;
    private final String desc;

    RemindIntervalUnitEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RemindIntervalUnitEnum getEnumByCode(String code) {
        for (RemindIntervalUnitEnum remindIntervalUnitEnum : RemindIntervalUnitEnum.values()) {
            if (remindIntervalUnitEnum.getCode().equals(code)) {
                return remindIntervalUnitEnum;
            }
        }
        return null;
    }
}
